using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace TurbaconPhone
{
    class StateManager
    {

        #region Fields
        Stack<State> stack;
        #endregion

        #region Properties
        #endregion

        #region Constructors
        public StateManager()
        {
            stack = new Stack<State>();
            //stack.Push(new GameplayState());
        }
        #endregion

        public State Pop()
        {
            if (stack.Count > 0)
            {
                State state = stack.Pop();
                state.ExitState();
                return state;
            }
            return null;
        }
        public void Push(State state)
        {
            if(stack.Count>0)
                Top().ExitState();
            stack.Push(state);

        }
        public Stack<State>.Enumerator getStates()
        {
            return stack.GetEnumerator();
        }
        public State Top()
        {
            return stack.Peek();
        }
    }
}
